/************************************************************************************************************************/
// Todo: numbers of day
var numDays =   {   
                    '1': 31, '2': 28, '3': 31, '4': 30, '5': 31, '6': 30, 
                    '7': 31, '8': 31, '9': 30, '10': 31, '11': 30, '12': 31
                }; 
// Todo: check if selected year is leap
function isLeapYear(year){
    if(year % 4 != 0 || year % 100 == 0 && year % 400 != 0){
        return false;
    }
    return true;

}

// Todo: Set days for selected month and year
function setDays(oYearSel, oMonthSel, oDaysSel)
{ 
    var nDays, oDaysSelLgth, opt, i = 1; 
    nDays = numDays[oMonthSel[oMonthSel.selectedIndex].value]; 
    if (nDays == 28 && isLeapYear(oYearSel[oYearSel.selectedIndex].value) ) 
        ++nDays; 
    
    oDaysSelLgth = oDaysSel.length; 
     if (nDays != oDaysSelLgth) { 
         if (nDays < oDaysSelLgth) 
             oDaysSel.length = nDays; 
         else for (i; i < nDays - oDaysSelLgth + 1; i++) { 
                  opt = new Option(oDaysSelLgth + i, oDaysSelLgth + i); 
                  oDaysSel.options[oDaysSel.length] = opt;
      } 
   } 
} 
/****************************************************************************/